#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 3010, INF = 0x3f3f3f3f;

int n;
char a[N][N], b[4][N][N];

void print(int k)
{
    for (int i = 1;i <= n;i++) {
        for (int j = 1;j <= n;j++)
            cout << b[k][i][j];
        cout << '\n';
    }
    cout << '\n';
}

void solve()
{
    cin >> n;
    for (int i = 1;i <= n;i++)
        for (int j = 1;j <= n;j++) {
            cin >> a[i][j];
            b[0][i][j] = a[i][j];
        }

    for (int k = 1;k <= 3;k++) {
        for (int i = 1;i <= n;i++)
            for (int j = 1;j <= n;j++)
                b[k][j][n - i + 1] = b[k - 1][i][j];
    }

    // for (int i = 0;i <= 3;i++) print(i);

    for (int i = 1;i <= n;i++) {
        for (int j = 1;j <= n;j++) {
            int k = min(min(i, n - i + 1), min(j, n - j + 1));
            // cout << k << ' ';
            k = k % 4;
            cout << b[k][i][j];
        }
        cout << '\n';
    }
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}